package com.google.code.sysarch.v4.main;

public class LoadingFrameThread extends Thread {
	
	public boolean loading = false;
	LoadingFrame wnd = null;
	

	
	public LoadingFrameThread() {
		wnd = new LoadingFrame();
	}
	
	
	synchronized public void display() {
		start();
	}
	
	public void hide() {
		loading = false;
	}
	
	
	public void run() {
		loading = true;
		wnd.setVisible(true);
		while (loading) {
	    	wnd.repaint();
			try {
				sleep(100);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		wnd.setVisible(false);
	}
	
	
    
	synchronized public void setState(String text) {
    	System.out.println("LOADINGFRAMETHREAD: Status has changed to '"+text+"'");
    	wnd.meinLabel.setText(text);
    }

}
